<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>0</div>
</body>

</html>

<script>

    let data = {
        count: 0
    }


    let p = new Proxy(data, {
        get(target, prop) {
            return Reflect.get(target, prop)
        },
        set(target, prop, val) {
            console.log('修改了data中的count');
            //  操作dom 更新页面
            document.querySelector('div').innerHTML = val
            Reflect.set(target, prop, val)
        },
        defineProperty() {

        }
    })

    console.log(p);
    p.count = p.count + 1
    console.log(p);
    console.log(data);
</script>